﻿using System;
using System.Windows.Data;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Globalization;
namespace InsuranceAdjuster.Helpers {

     public class ExtractDateConverter : IValueConverter {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
            DateTime dt = (DateTime) value;
            var names = "January February March April May June July August September October November December".Split(' ');
            return string.Format("{0} {1}", names[dt.Month-1], dt.Day);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
            throw new NotSupportedException();
        }
    }

     public class ExtractTimeConverter : IValueConverter {
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
             DateTime dt = (DateTime)value;
             int hour = (dt.Hour < 13) ? dt.Hour : dt.Hour - 12;
             return string.Format("{0}:{1:D2}", hour, dt.Minute);
         }

         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
             throw new NotSupportedException();
         }
     }
 }